﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Data.Common;
using Biblioteca.Utils;

namespace SERIX
{
    public partial class Modelo_List : System.Web.UI.Page
    {
        public static DataTable ObterDadosGrid()
        {
            return SERIX.Classes.util.ObterTabela("IDT;COLUNA",
                "1;Coluna 1",
                "2;Coluna 2",
                "3;Coluna 3",
                "4;Coluna 4",
                "5;Coluna 5",
                "6;Coluna 6",
                "7;Coluna 7",
                "8;Coluna 8",
                "9;Coluna 9");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            }
        }

        protected void btnNovo_Click(object sender, EventArgs e)
        {
            Response.Redirect("Modelo_Manut.aspx?OP=I");
        }

        protected void btnPequisar_Click(object sender, EventArgs e)
        {
        }

        protected void btnTodos_Click(object sender, EventArgs e)
        {
        }

        protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string IDT = ((DataRowView)e.Row.DataItem).Row["IDT"].ToString();
                //Se tiver permissao de Manutenção
                ((HyperLink)e.Row.Cells[gridView.Columns.Count - 4].Controls[1]).NavigateUrl = "Modelo_Manut.aspx?OP=R&idt=" + Server.UrlEncode(Criptografia.Criptografar(IDT)) + "&ABA=0";
                ((HyperLink)e.Row.Cells[gridView.Columns.Count - 3].Controls[1]).NavigateUrl = "Modelo_Manut.aspx?OP=U&idt=" + Server.UrlEncode(Criptografia.Criptografar(IDT)) + "&ABA=0";
                ((HyperLink)e.Row.Cells[gridView.Columns.Count - 2].Controls[1]).NavigateUrl = "Modelo_Manut.aspx?OP=DATANASC_CONJUGE&idt=" + Server.UrlEncode(Criptografia.Criptografar(IDT)) + "&ABA=0";
            }
        }

        protected void ddlOpcoes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (((DropDownList)sender).SelectedIndex == 1){
               Response.Redirect("PaginaOpcao1.aspx");
            }
        }

    }
}
